A messaging service may be implemented via a publicly-hosted distributed messaging system that provides support for a variety of messaging patterns. These messaging patterns may include, but are not limited to, a queue-based messaging pattern or a topic-based messaging pattern. In accordance with a queue-based messaging pattern, clients referred to as publishers can enqueue/publish messages, which are stored in the messaging system. Eventually, clients referred to as consumers can dequeue the messages. Every single published message goes to only one consumer. In accordance with a topic-based messaging pattern, several publishers can enqueue/publish messages, which are stored in the messaging system. Multiple subscribers may have a registered interest, referred to as a “subscription,” for receiving messages that are published to the topic. Subscribers may also optionally register rules/filters to determine if they are interested in a message. Every message that is published to the topic is delivered to all the matching subscriptions.
In certain messaging service implementations, if a user wishes to receive a message from a particular queue or subscription, then the following steps must be performed: (1) a connection is established to the messaging service; (2) a receive request is lodged for the particular queue or subscription; and (3) when the particular queue or subscription receives a message, a response is sent for that particular queue or subscription. In accordance with such an implementation, if a user wishes to listen for messages across a small number of queues/subscriptions (e.g., in the order of 100s), then the above steps can be performed for each queue without significantly impairing system performance. However, if a user wishes to listen for messages across a large number of queues/subscriptions (e.g., millions of them), then the above approach simply does not scale. For example, in certain implementations, sending one million receive requests alone could take on the order of hours, which would likely be considered unacceptable. Furthermore, if the queues or subscriptions are sparsely populated with data, then a large amount of network traffic is generated by the user for retrieving a comparatively negligible amount of data.
The features and advantages of the present invention will become more apparent from the detailed description set forth below when taken in conjunction with the drawings, in which like reference characters identify corresponding elements throughout. In the drawings, like reference numbers generally indicate identical, functionally similar, and/or structurally similar elements. The drawing in which an element first appears is indicated by the leftmost digit(s) in the corresponding reference number.